#ifndef TTMSGMAP_H
#define TTMSGMAP_H
#include "mySingleton.h"
#include "IttFunc.h"

#include <list>
#include <windows.h>
class ttMsgMap:
	public Singleton<ttMsgMap>
{
private:
	typedef std::list<IttFunc*> TTLIST;
public:
	typedef struct _msgloopvar{
		typedef struct _msg{
			_msg();
			WCHAR buf[256];
		}msg, *pmsg;
		typedef std::list<pmsg> MSGLIST; 
		MSGLIST m_msglist;// to print sentences on screen
		CRITICAL_SECTION m_csMsgList;
		HINSTANCE m_MainInstance;
		int m_cx, m_cy;
		RECT m_MainRect;
		int WIDTH, HEIGHT;
		bool m_bMessaging;
		HWND m_hMsg;
		bool m_bMsgHavEdit;
		~_msgloopvar();			
		int DrawMsg(HDC hdc);
	} msgloopvar;

private:
	TTLIST m_MsgMap;
	IttFunc *m_defFunc;
public:
	msgloopvar m_msglpvar;

private:
	int callDefFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
public:
	ttMsgMap();
	~ttMsgMap();
	int push_front(IttFunc*);
	int run(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
	int setDefFunc(IttFunc *);
};
#endif